<?php

namespace SunAdmin\Service\FileSystem;

use think\file\UploadedFile;

class FileManager extends FilesystemBase
{
    /**
     * 快捷上传方法
     */
    public function upload(UploadedFile $file, string $uploaderType, int $uploaderUid, string $path = 'sunAdmin'): array
    {
        $upload = new Upload($this->currentDisk);
        return $upload->setFile($file)
            ->setUploader($uploaderType, $uploaderUid)
            ->upload($path);
    }

    /**
     * 快捷删除方法
     */
    public function delete(int $attachmentId): array
    {
        $delete = new Delete($this->currentDisk);
        return $delete->deleteById($attachmentId);
    }

    /**
     * 快捷下载方法
     */
    public function download(int $attachmentId)
    {
        $download = new Download($this->currentDisk);
        return $download->downloadById($attachmentId);
    }

    /**
     * 快捷移动方法
     */
    public function move(string $fromPath, string $toPath): array
    {
        $move = new Move($this->currentDisk);
        return $move->move($fromPath, $toPath);
    }

    /**
     * 获取上传服务
     */
    public function getUploadService(): Upload
    {
        return new Upload($this->currentDisk);
    }

    /**
     * 获取删除服务
     */
    public function getDeleteService(): Delete
    {
        return new Delete($this->currentDisk);
    }

    /**
     * 获取下载服务
     */
    public function getDownloadService(): Download
    {
        return new Download($this->currentDisk);
    }

    /**
     * 获取移动服务
     */
    public function getMoveService(): Move
    {
        return new Move($this->currentDisk);
    }
} 